---
title: bud.pipe
description: Pipe a value through an array of functions
tags:
  - helpers
---

Pipe a value through an array of functions.

Unlike [bud.sequence](/reference/bud.sequence) the output of each function is used as input for the next.

## Usage

Pass an array of functions to be executed in sequence. Execution order is guaranteed even if the functions are async.

The output of each function will be used as input for the next arrayed function. The intial function will receive the bud.js instance as input.

```ts title=bud.config.ts
await bud.pipe([
  async bud => bud.minimize(),
  async bud => await bud.fs.read(`./src/index.js`),
])
```

You can pass a second parameter to be used as an initial value.

```ts title=bud.config.ts
await bud.pipe(
  [
    async v => `${v}!`, // `this in the initial value!`
    async v => `${v}!`, // `this is the initial value!!`
    async v => `${v}!`, // `this is the initial value!!!`
  ],
  `this is the initial value`,
)
```

## Related

- [bud.sequence](/reference/bud.sequence)
